<!-- 评分题 -->

<template>
  <div class="DetailQuestionnaire-MyStatistic-table">
    <div :class="obj.max === 10 ? 'quar' : 'half'">
      <div class="DetailQuestionnaire-MyStatistic-table-row">
        <div class="percent20">星数</div>
        <div class="percent50">描述</div>
        <div class="percent30">计数</div>
      </div>

      <div v-for="star in 5" :key="star" class="DetailQuestionnaire-MyStatistic-table-row">
        <div class="percent20">{{ obj.rateList[star - 1].star }}</div>
        <div class="percent50">{{ obj.rateList[star - 1].tip }}</div>
        <div class="percent30">{{ obj.rateList[star - 1].num }}</div>
      </div>
    </div>

    <div v-if="obj.max === 10" class="quar">
      <div class="DetailQuestionnaire-MyStatistic-table-row">
        <div class="percent20">星数</div>
        <div class="percent50">描述</div>
        <div class="percent30">计数</div>
      </div>

      <div v-for="star in 5" :key="star" class="DetailQuestionnaire-MyStatistic-table-row">
        <div class="percent20">{{ obj.rateList[star + 4].star }}</div>
        <div class="percent50">{{ obj.rateList[star + 4].tip }}</div>
        <div class="percent30">{{ obj.rateList[star + 4].num }}</div>
      </div>
    </div>

    <div class="half full">
      <ChartColumn v-bind="obj.numChart" />
    </div>
  </div>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import MyRadio from '../MyRadio'

// ============================== 导出组件 ============================== //

export default CORE.extend(MyRadio, {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'MyRate',

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 是否为十星
     */
    isTen() {
      return this.obj.max === 10
    },
  },
})
</script>
